package com.guigu.qingcheng.orderservice.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.guigu.qingcheng.pojo.order.TbOrderItem;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author testjava
 * @since 2020-07-08
 */
public interface TbOrderItemMapper extends BaseMapper<TbOrderItem> {

    @Select(" SELECT oi.name Spname, oi.price price," +
            " oi.num Spnum, sk.num Kcnum, sk.spec spce" +
            " FROM qingcheng_goods.`tb_sku` sk, tb_order_item oi " +
            "WHERE sk.id = oi.sku_id AND oi.order_id = #{id}\n")
    public List<Map> list (@Param("id") String id);

    @Select("SELECT t.num Kc,t.spec,i.* FROM tb_order_item i,qingcheng_goods.`tb_sku` t WHERE i.sku_id=t.id AND i.order_id = #{id}\n")
    public List<Map> listgoods (@Param("id") String id);

}
